<extend name="Public/base"/>
<block name="body">
    <div class="main-title">
        <h2>{:isset($info['id'])?'编辑':'新增'}商品</h2>
    </div>
    <form action="{:U(Shop/add)}" method="post" class="form-horizontal" 
   enctype="multipart/form-data">
        <div class="form-item">
            <label class="item-label">商品名称<span class="check-tips"></span></label>
            <div class="controls">
                <input type="text" class="text input-large" name="name" value="{$res.name|default=''}">
                <input type="hidden" name="id" value="{$info['id']|default=''}">
            </div>
        </div>
        <div class="form-item">
            <label class="item-label">商品描述<span class="check-tips"></span></label>
            <div class="controls">
                <input type="text" class="text input-large" name="des" value="{$res.des|default=''}">
            </div>
        </div>
        <div class="form-item">
            <label class="item-label">商品分类<span class="check-tips"></span></label>
            <div class="controls">
                <select name="case" id="cate">
                    <option value="">请选择</option>
                    <volist name='cate' id='vv'>
                    <option value="{$vv['id']}">{$vv['title']}</option>
                    </volist>              
                </select>
            </div>
        </div>
        <div class="form-item">
            <label class="item-label">商品主图(支持多图上传)<span class="check-tips"></span></label>
            <div class="controls">
                <input type="file" class="text input-large" name="pic[]" id="pic" multiple onchange="viewmypic(showimg,this.form.pic);">
            </div>
        </div>
        <div class="">
            <label class="item-label">详情页上传(百度编辑器)<span class="check-tips"></span></label>
            <div class="">
                <script id="editor" type="text/plain" style="width:600px;height:300px;" name="content"
                                                ></script>
                                                
            </div>
        </div>
        
        <input type="hidden" name="" value="">
        <div class="form-item">
            <label class="item-label">是否上架<span class="check-tips"></span></label>
            <div class="controls">
                <input type="radio" name="issel" value="1" {$res['issel']?'checked':''}>是
                <input type="radio" name="issel" value="0" {$res['issel']?'':'checked'}>否
            </div>
        </div>
        <div class="form-item">
            <label class="radio">是否热卖<span class="check-tips">(限时抢购)</span></label>
            <div class="controls">
                <input type="radio" name="ishot" value="1" {$res['ishot']?'checked':''}>是
                <input type="radio" name="ishot" value="0" {$res['ishot']?'':'checked'}>否
            </div>
        </div>
        <div class="form-item">
            <label class="item-label">到期时间(可以不选)<span class="check-tips"></span></label>
            <div class="controls">
                <input type="text" class="text input-large time" name="endtime" value="">
            </div>
        </div>
    
        <div class="form-item">
            <!-- <button class="btn submit-btn ajax-post" id="submit" type="submit" target-form="form-horizontal">确 定</button> -->
            <input type="submit"  class="btn submit-btn " name="" value="确定">
            <button class="btn btn-return" onclick="javascript:history.back(-1);return false;">返 回</button>
        </div>
    </form>
    <img name="showimg" id="showimg" src="" style="display:none;" alt="预览图片" />    
    <!-- <iframe style="display:none" name='hidden_frame' id="hidden_frame"></iframe> 
    <div class="fromtrs"> 
        <img id="img" src="" width="80" height="80"/> 
    </div> --> <!-- 隐藏表单 -->
</block>

<block name="script">
    <script type="text/javascript">
        //导航高亮
        highlight_subnav('{:U('Shop/index')}');
    </script>
   <script>        
function viewmypic(mypic,imgfile) {         
if (imgfile.value){

mypic.src=imgfile.value;  
mypic.style.display='block';         
mypic.border=1;         
}         
}         
</script>     

    <script type="text/javascript">
        $(function(){
          $("body").on('change','select',function(){
            var id = $(this).val();
            var t = $(this);
            $.post("{:U('Shop/getchild')}",{ id:id }, function(data){
                if(data.status ==1){
                    t.nextAll().remove();
                    t.after(data.info);
                }else{
                    t.nextAll().remove();
                }
            
         });

        })
      });
      </script>
      

        <link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
<php>if(C('COLOR_STYLE')=='blue_color') echo '<link href="__STATIC__/datetimepicker/css/datetimepicker_blue.css" rel="stylesheet" type="text/css">';</php><!-- 可以注释 -->
<link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js" charset="UTF-8"></script>
<script type="text/javascript">

$('#submit').click(function(){
    $('#form').submit();
});

$(function(){
    $('.time').datetimepicker({
        format: 'yyyy-mm-dd hh:ii',
        language:"zh-CN",
        minView:2,
        autoclose:true
    });
    showTab();

    

});

  </script>

  <script type="text/javascript" charset="utf-8" src="/Public/utf8-php/ueditor.config.js"></script>
   <script type="text/javascript" charset="utf-8" src="/Public/utf8-php/ueditor.all.min.js"> </script>
    <script type="text/javascript" charset="utf-8" src="/Public/utf8-php/lang/zh-cn/zh-cn.js"></script>
    <script type="text/javascript">
                                     var ue = UE.getEditor('editor',{toolbars: [
                                        ['fullscreen', 'source', 'undo', 'redo','emotion'],
                                        ['bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'superscript', 'subscript', 'removeformat', 'formatmatch', 'autotypeset', 'blockquote', 'pasteplain', '|', 'forecolor', 'backcolor', 'insertorderedlist', 'insertunorderedlist', 'selectall', 'cleardoc'],['insertparagraphbeforetable','insertcode','justifyleft','justifyright','justifycenter','justifyjustify','forecolor','backcolor','fontfamily','fontsize','paragraph','simpleupload','insertimage','link','emotion','spechars','searchreplace', ]
                                        ]}); 
                                    </script>
</block>
